import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

export default {
    input: 'src/index.ts',
    output: [
        {
            exports: 'auto',
            dir: 'dist/cjs',
            format: 'cjs',
            sourcemap: true,
        },
        {
            exports: 'auto',
            dir: 'dist/esm',
            format: 'esm',
            sourcemap: true,
        },
    ],
    plugins: [
        typescript(),
        nodeResolve({ preferBuiltins: true }), // 处理第三方模块
        commonjs() // 将ES模块转换为CommonJS
    ],
}